'use strict';
const db = uniCloud.database()
const coll = db.collection('user')
const coll2 = db.collection('guanzhong')
exports.main = async (event, context) => {

	//event index参数0 是选手  1是观众
	if (event.index == 0) {
		let res = await coll.orderBy('zongfen', 'desc').orderBy('shijian', 'asc').get()
		return res
	} else {
		let res = await coll2.orderBy('zongfen', 'desc').orderBy('shijian', 'asc').get()
		return res
	}
};
